import service from '@/utils/request.js'
// 将所有的针对reserve的请求，都封装到一个对象reserveApi中
// reserveApi封装了所有后端操作的接口（路径）

const reserveApi = {
    list(reserveQuery) {
        return service.get('/reserve/list', {params: reserveQuery})
    },
    listByUserId(reserveQuery) {
        return service.get('/reserve/listByUserId', {params: reserveQuery})
    },
    selectAll() {
        return service.get('/reserve/selectAll')
    },
    deleteById(id) {
        return service.delete( `/reserve/deleteById/${id}`)
    },
    deleteAll(ids) {
        return service.delete( `/reserve/deleteAll/${ids}`)
    },
    add(reserve) {
        //reserve以JSON形式传递到后台，后端使用@RequestBody接收
        return service.post('/reserve/add', reserve)
    },
    selectById(id) {
        return service.get(`/reserve/selectById/${id}`)
    },
    update(reserve) {
        return service.put('/reserve/update', reserve)
    },
    updateStatus(id, status) {
        return service.put(`/reserve/updateStatus/${id}/${status}`)
    },
}

export default reserveApi

